package com.tot.io;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Scanner;

/**
 *java IO ���
 * Created by TOT on 2016/5/25.
 */
public class ReadMe {
    public static void main(String[] args)throws Exception {
        //用于读取源文件的
        RandomAccessFile src
                = new RandomAccessFile("D:\\1.avi","r");

        //用于写文件的
        RandomAccessFile des
                = new RandomAccessFile("D:\\2.avi","rw");

        int d = -1;

        long start = System.currentTimeMillis();
        byte[] temp = new byte[10];
        while( ( d
                = src.read(temp) )  != -1  ){
            des.write(temp);
        }

        long end = System.currentTimeMillis();

        System.out.println("复制完毕了");
        System.out.println("用时:" + (end - start) + "毫秒");
        src.close();
        des.close();
    }
}
